package com.fsnbigdata.service.api;

import com.fsnbigdata.domain.Enterprise;
import com.fsnbigdata.domain.EnterpriseEcosystem;
import com.fsnbigdata.domain.EnterpriseImage;
import com.fsnbigdata.domain.EnterpriseProduct;
import com.fsnbigdata.domain.Entrepreneur;
import com.fsnbigdata.domain.dto.NamingPair;
import com.querydsl.core.types.Predicate;
import io.springlets.data.domain.GlobalSearch;
import io.springlets.format.EntityResolver;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.roo.addon.layers.service.annotations.RooService;

import java.util.List;

/**
 * = EnterpriseService
 *
 * TODO Auto-generated class documentation
 *
 */
@RooService(entity = Enterprise.class)
public interface EnterpriseService extends EntityResolver<Enterprise, Long> {

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return Enterprise
     */
    public abstract Enterprise findOne(Long id);

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     */
    public abstract void delete(Enterprise enterprise);

    /**
     * TODO Auto-generated method documentation
     *
     * @param entities
     * @return List
     */
    public abstract List<Enterprise> save(Iterable<Enterprise> entities);

    /**
     * TODO Auto-generated method documentation
     *
     * @param ids
     */
    public abstract void delete(Iterable<Long> ids);

    /**
     * TODO Auto-generated method documentation
     *
     * @param entity
     * @return Enterprise
     */
    public abstract Enterprise save(Enterprise entity);

    public Integer deleteImages(Long id);
    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return Enterprise
     */
    public abstract Enterprise findOneForUpdate(Long id);

    /**
     * TODO Auto-generated method documentation
     *
     * @param ids
     * @return List
     */
    public abstract List<Enterprise> findAll(Iterable<Long> ids);

    /**
     * TODO Auto-generated method documentation
     *
     * @return List
     */
    public abstract List<Enterprise> findAll();

    /**
     * TODO Auto-generated method documentation
     *
     * @return Long
     */
    public abstract long count();

    /**
     *
     * @param predicate
     * @param pageable
     * @return
     */
    public abstract Page<Enterprise> search(Predicate predicate, Pageable pageable);

    /**
     * TODO Auto-generated method documentation
     *
     * @param globalSearch
     * @param pageable
     * @return Page
     */
    public abstract Page<Enterprise> findAll(GlobalSearch globalSearch, Pageable pageable);


    /**
     * TODO Auto-generated method documentation
     *
     * @param globalSearch
     * @param pageable
     * @return Page
     */
    public abstract Page<Enterprise> findAll(GlobalSearch globalSearch, Pageable pageable, String creator);

    /**
     * TODO Auto-generated method documentation
     *
     * @param ids
     * @param globalSearch
     * @param pageable
     * @return Page
     */
    public abstract Page<Enterprise> findAllByIdsIn(List<Long> ids, GlobalSearch globalSearch, Pageable pageable);

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @param ecosystemsToAdd
     * @return Enterprise
     */
    public abstract Enterprise addToEcosystems(Enterprise enterprise, Iterable<EnterpriseEcosystem> ecosystemsToAdd);

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @param ecosystemsToRemove
     * @return Enterprise
     */
    public abstract Enterprise removeFromEcosystems(Enterprise enterprise, Iterable<Long> ecosystemsToRemove);

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @param entrepreneursToAdd
     * @return Enterprise
     */
    public abstract Enterprise addToEntrepreneurs(Enterprise enterprise, Iterable<Entrepreneur> entrepreneursToAdd);

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @param entrepreneursToRemove
     * @return Enterprise
     */
    public abstract Enterprise removeFromEntrepreneurs(Enterprise enterprise, Iterable<Long> entrepreneursToRemove);

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @param imagesToAdd
     * @return Enterprise
     */
    public abstract Enterprise addToImages(Enterprise enterprise, Iterable<EnterpriseImage> imagesToAdd);

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @param imagesToRemove
     * @return Enterprise
     */
    public abstract Enterprise removeFromImages(Enterprise enterprise, Iterable<Long> imagesToRemove);

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @param productsToAdd
     * @return Enterprise
     */
    public abstract Enterprise addToProducts(Enterprise enterprise, Iterable<EnterpriseProduct> productsToAdd);

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @param productsToRemove
     * @return Enterprise
     */
    public abstract Enterprise removeFromProducts(Enterprise enterprise, Iterable<Long> productsToRemove);

    List<NamingPair> findAllByInitial(String initial);
    
    List<List<Enterprise>> findAllByType();

    List findByPageAndSize(String type,String legalPerson,String organizationCode,
                                       String name, String category,String enterPriseName,
                                       String productName,Pageable pageable);//分页查询

    public String findByNameById(Long id);
}
